package Combine;

import java.util.List;

public class Composite extends Component {
    private List<Component> componentList;

    @Override
    public void add(Component component) {
        System.out.println("Add Componet");
    }

    @Override
    public void remove(Component component) {
        System.out.println("Remove Component");
    }

    @Override
    public Component getChild(int index) {
        System.out.println("Return One Component");
        return new Composite();
    }

    @Override
    public void display() {
        for (Component component : componentList) {
            component.display();
        }
    }
}
